package com.hung.common;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * Created by Administrator on 2017/4/17.
 */
public class ResponseResult {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String errMsg;

    private Boolean success;

    private Object data;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer errCode;

    private ResponseResult(Object data){
        this.data = data;
        this.success = true;
    }

    private ResponseResult(Integer errCode,String errMsg){
        this.errCode = errCode;
        this.success = false;
        this.errMsg = errMsg;
    }

    public static ResponseResult wrap(Object data){
       return new ResponseResult(data);
    }
    public static ResponseResult wrap(int errCode ,String errMsg){
        return new ResponseResult(errCode,errMsg);
    }


    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public Boolean isSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getErrCode() {
        return errCode;
    }

    public void setErrCode(Integer errCode) {
        this.errCode = errCode;
    }
}
